<script type="text/javascript" src="<{$APP_PATH}>/includes/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="<{$APP_PATH}>/includes/ueditor/ueditor.all.js"></script>
<div class=" main-content">
    <div class="inner">
        <div class="lib-edit">
            <div class="header">
                <a href="<{$APP_PATH}>/home/info/index.php?type=lbs"><i class="icons icons-back"></i> LBS内容编辑</a>
            </div>
            <div class="content">
                <div class="preview">
                    <div class="cell">
                        <div class="lib-title">
                            <span  style="font-size:14px;"><{if $infoRow.video_name}><{$infoRow.video_name}><{else}>位置名称<{/if}> </span>
                            <p><{$today}></p>
                        </div>
                        <div class="cover">
                            <{if $infoRow.location_pic}>
                            <img src="<{$APP_PATH}>/data/image_c/<{$infoRow.location_pic}>" style="width:246px;height:136px;" />
                            <{else}>
                            <div class="img-default"> 封面图片 </div>
                            <{/if}>
                        </div>
                    </div>
                </div><div class="editor">
                    <form id="text-form" method="post" action="<{$APP_PATH}>/home/info/lbs.php">
					<div class="cell cell-dark">
                        <div class="form-rule form-rule-add" role="form">
                            <div class="form-group">
                                <label>位置名称<strong class="c-red">*</strong> </label>
                                <input name="location_name" type="text" class="form-control" value="<{$infoRow.location_name}>">
                            </div>
							<div class="form-group">
								<label>封面 <input name="show" type="checkbox" value="1" <{if $infoRow.pic_showincontent==1}>checked<{/if}>/> <span class="c-gray"><span class="c-green">正文内显示</span>(大图片建议尺寸：720像素*400像素)</span></label>
								<div class="fg-upload" onclick="$('#img-file').click()">
									<input id="local-image" type="text" readonly class="form-control" value='' style="padding-left:70px;">
									<a href="javascript:void(0);" class="btn-upload"><i class="icons icons-upload"></i>上传</a>
								</div>
							</div>
							<div class="form-group">
                                <label><a href="#" class="c-green fz12px" onclick="$('#location_desc').show();return false;">添加摘要</a> <span class="c-gray">(120字符)</span></label>
                                <textarea id="location_desc" name="location_desc" <{if !$infoRow.location_desc}>style="display:none"<{/if}> class="form-control textarea-sum" cols="20" rows="10"><{$infoRow.location_desc}></textarea>
                            </div>
							<div class="form-group">
                                <label>位置介绍<strong class="c-red">*</strong> </label>
								<textarea name="location_intro" id="goods_intro"><{$infoRow.location_intro}></textarea>
                            </div>
							
							<div class="form-group">
                                <label>维度<strong class="c-red">*</strong> </label>&nbsp;&nbsp;&nbsp;&nbsp;<span>不知道经纬度点这里-></span><a href="http://www.gpsspg.com/maps.htm" target="_blank" style="color: #4C7E05;">经纬度查询</a>
                                <input name="x_dian" type="text" class="form-control" value="<{$infoRow.x_dian}>">
                            </div>
							<div class="form-group">
                                <label>经度<strong class="c-red">*</strong> </label>
                                <input name="y_dian" type="text" class="form-control" value="<{$infoRow.y_dian}>">
                            </div>
							<div class="form-group">
                                <label>状态<span class="c-gray"></span></label>
								<br/>
                                <input type="radio" name="state" <{if $infoRow.state==1}>checked<{/if}> value='1'> 开放&nbsp;&nbsp;
                                <input type="radio" name="state"<{if $infoRow.state==2}>checked<{/if}>  value='2'> 关闭
                            </div>
                        </div>
                    </div>

                    <div class="opt">
                        <input type="hidden" name="id" value="<{$infoRow.id}>" />
						<input type="hidden" name="location_pic" id="info_pic" value="<{$infoRow.location_pic}>" />
                        <input type="submit" class="btn btn-large btn-success" value="完成">
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<div style="display:none">
	<iframe name='img-frame' id="img-frame" style="display:none"></iframe>
	<form id="img-form" action="<{$APP_PATH}>/home/info/upload.php" encType="multipart/form-data" method="post" target="img-frame" >
		<input type="file" name="imgfile" id="img-file" onchange="$('#img-form').submit();" />
	</form>
</div>
<script type="text/javascript">
    set_title_name('源资料库-LBS');
    set_menu_cur('menu_16','cur super');
   $(function(){
		var uea = UE.getEditor('goods_intro');
        $('#text-form').submit(function(){
            $.post($(this).attr('action'),$(this).serializeArray(),function(msg){
                try{
                    var obj = $.parseJSON(msg);
                    if(obj.success==1){ window.location.href='index.php?type=lbs';}else{
                        var evt = {clientX:$('input[type="submit"]').offset().left,clientY:$('input[type="submit"]').offset().top-230};
                    	note_info(obj.msg,'warn',evt);
                    }
                }catch(e){}
            });
            return false;
        });
		
		//$('input[name=state]').attr('checked',true);
		$('select[name=cate_id]').val("<{$infoRow.cate_id}>");
    });
	
	    $('#img-frame').load(function(){
        try{var html = $(this).contents().find('body').html();
    	}catch(e){ var html = window.frames["upload_frame"].document.body.innerText;}
    	
    	try{
    	    var result	= $.parseJSON(html);
    	    if(result.success==1){
    	    	$('#info_pic').val(result.data.path);
    	    	$('.cover').html('<img src="../../data/image_c/'+result.data.path+'" style="width:246px;height:136px;" />');
    	    }else{
    	    	alert(result.msg);
    	    	//note_info(result.msg, 'warn', $('#local-image'));
    	    }
    	}catch(e){ }
    });
    $('#img-file').change(function(){
    	$('#local-image').val($(this).val());
    });
</script>